SchemaView performance improvements - #1479
Conversation
… selected schemas
…ull ECN::PrimitiveType support
…nd logging on value saturation
…as and SchemaViewWriter
There was a problem hiding this comment.
Pull request overview
This PR extends ECDb’s ECSQL pragma surface to support incremental SchemaView loading (fragments) for iTwinjs-core, and introduces a cheap schema identity hash (schema_token) intended for cache invalidation and determinism checks.
Changes:
- Add
PRAGMA schema_view_fragment(...)to return a subset of schemas as a SchemaView-format blob for incremental loading. - Add
PRAGMA checksum(schema_token)backed by a new “name+version only” schema identity hash, and alignschema_view’sschemaTokenwith it. - Refactor/extend
SchemaViewWriterto support fragment filtering and safer state reuse; reduce noisy parameter-missing logs in concurrent query limit binding.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| iModelCore/ECDb/Tests/NonPublished/ECSqlPragmasTests.cpp | Updates checksum/token assertions and adds coverage for schema_token and schema_view_fragment behavior. |
| iModelCore/ECDb/ECDb/SchemaViewWriter.h | Adds fragment-related API/state and clarifies non-concurrent instance usage. |
| iModelCore/ECDb/ECDb/SchemaViewWriter.cpp | Implements fragment filtering, request validation, centralized reset, and safer narrowing for serialized fields. |
| iModelCore/ECDb/ECDb/ECSql/ECSqlPragmas.h | Extends checksum docs/options and declares schema_view_fragment + schema-token hashing support. |
| iModelCore/ECDb/ECDb/ECSql/ECSqlPragmas.cpp | Implements checksum(schema_token), shared schema_view row building, and schema_view_fragment argument parsing. |
| iModelCore/ECDb/ECDb/ECDbImpl.cpp | Registers the new schema_view_fragment pragma handler. |
| iModelCore/ECDb/ECDb/ConcurrentQueryManagerImpl.cpp | Uses TryGetParameterIndex to avoid log spam when LIMIT/OFFSET params don’t exist (e.g., PRAGMAs). |
…ct zero as a valid schema ID
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…d resilience in SchemaView handling
…in/imodel-native into rschili/schema-view-fragment
… and adjust related tests
| // because the pragma grammar allows only one. Schema names are ECNames, so a ';' always means a | ||
| // version prefix. | ||
| uint8_t requestedVersion = CURRENT_FORMAT_VERSION; | ||
| Utf8String nameList = arg; |
There was a problem hiding this comment.
We are just doing parsing of arg here. Can't we use string_view here? instead of string?
There was a problem hiding this comment.
Good call, done. The version-prefix parsing now works on std::string_view slices over the single
materialized argument string; nameList stays a suffix of it, so its data() remains a valid
null-terminated string for BeStringUtilities::Split. The per-token Utf8Strings stay - Trim,
ECNameValidation::IsValidName and the bind need them anyway.
…d performance and clarity
|
/azp run imodel-native |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run imodel-native |
|
Azure Pipelines successfully started running 1 pipeline(s). |
itwinjs-core: iTwin/itwinjs-core#9431
New schema view fragment pragma that will be used by iTwinjs-core to load just subsets of an iModels' schema.
Plus a few fixes, please read the linked itwinjs-core PR description and issue for full details.